<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>HTTP Request &mdash; cpp-netlib v0.12.0</title>
    
    <link rel="stylesheet" href="../_static/pyramid.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '0.12.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="cpp-netlib v0.12.0" href="../contents.html" />
    <link rel="up" title="Reference Manual" href="../reference.html" />
    <link rel="next" title="HTTP Response" href="http_response.html" />
    <link rel="prev" title="HTTP Client API" href="http_client.html" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="../_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
<![endif]-->

  </head>
  <body role="document">

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="http_response.html" title="HTTP Response"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="http_client.html" title="HTTP Client API"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../contents.html">cpp-netlib v0.12.0</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="../reference.html" accesskey="U">Reference Manual</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="http-request">
<h1>HTTP Request<a class="headerlink" href="#http-request" title="Permalink to this headline">¶</a></h1>
<p>This part of the documentation talks about the publicly accessible API of the
HTTP Request objects. This section details the <a class="reference internal" href="#request-concepts">Request Concepts</a> requirements,
the implemented and required <a class="reference internal" href="#directives">Directives</a>, <a class="reference internal" href="#modifiers">Modifiers</a>, and <a class="reference internal" href="#wrappers">Wrappers</a> that work
with the HTTP Request objects.</p>
<div class="section" id="request-concepts">
<h2>Request Concepts<a class="headerlink" href="#request-concepts" title="Permalink to this headline">¶</a></h2>
<p>There are two generally supported Request Concepts implemented in the library.
The first of two is the <a class="reference internal" href="#normal-client-request-concept">Normal Client Request Concept</a> and the second is the
<a class="reference internal" href="#pod-server-request-concept">Pod Server Request Concept</a>.</p>
<p>The <a class="reference internal" href="#normal-client-request-concept">Normal Client Request Concept</a> is what the HTTP Client interface requires.
All operations performed internally by the HTTP Client abide by the interface
required by this concept definition.</p>
<p>The <a class="reference internal" href="#pod-server-request-concept">Pod Server Request Concept</a> is as the name suggests what the HTTP Server
implementation requires from Request Objects.</p>
<p>Switching on whether the <cite>Request</cite> concept chooses either of the <a class="reference internal" href="#normal-client-request-concept">Normal Client
Request Concept</a> or the <a class="reference internal" href="#pod-server-request-concept">Pod Server Request Concept</a> is done through the
nested <code class="docutils literal"><span class="pre">tag</span></code> type and whether that tag derives from the root tag <code class="docutils literal"><span class="pre">pod</span></code>.
Simply, if the Request type&#8217;s nested <code class="docutils literal"><span class="pre">tag</span></code> type derives from
<code class="docutils literal"><span class="pre">boost::network::tags::pod</span></code> then it chooses to enforce the <a class="reference internal" href="#pod-server-request-concept">Pod Server Request
Concept</a>, otherwise it chooses the <a class="reference internal" href="#normal-client-request-concept">Normal Client Request Concept</a>.</p>
<div class="section" id="normal-client-request-concept">
<h3>Normal Client Request Concept<a class="headerlink" href="#normal-client-request-concept" title="Permalink to this headline">¶</a></h3>
<p>A type models the Normal Client Request Concept if it models the <a class="reference external" href="../in_depth/message.html#message-concept">Message
Concept</a> and also supports the following constructs.</p>
<p><strong>Legend</strong></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">R:</th><td class="field-body">The request type.</td>
</tr>
<tr class="field-even field"><th class="field-name">r:</th><td class="field-body">An instance of R.</td>
</tr>
<tr class="field-odd field"><th class="field-name">S:</th><td class="field-body">The string type.</td>
</tr>
<tr class="field-even field"><th class="field-name">s:</th><td class="field-body">An instance of S.</td>
</tr>
<tr class="field-odd field"><th class="field-name">P:</th><td class="field-body">The port type.</td>
</tr>
<tr class="field-even field"><th class="field-name">p:</th><td class="field-body">An instance of P.</td>
</tr>
</tbody>
</table>
<table border="1" class="docutils">
<colgroup>
<col width="30%" />
<col width="17%" />
<col width="53%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Construct</th>
<th class="head">Result</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal"><span class="pre">R::string_type</span></code></td>
<td><code class="docutils literal"><span class="pre">S</span></code></td>
<td>The nested <code class="docutils literal"><span class="pre">string_type</span></code> type.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">R::port_type</span></code></td>
<td><code class="docutils literal"><span class="pre">P</span></code></td>
<td>The nested <code class="docutils literal"><span class="pre">port_type</span></code> type.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">R</span> <span class="pre">r(s)</span></code></td>
<td><strong>NA</strong></td>
<td>Construct a Request with an <code class="docutils literal"><span class="pre">s</span></code>
provided. This treats <code class="docutils literal"><span class="pre">s</span></code> as the URI
to where the request is destined for.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">host(request)</span></code></td>
<td>Convertible
to <code class="docutils literal"><span class="pre">S</span></code></td>
<td>Return the host to where the request
is destined for.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">port(request)</span></code></td>
<td>Convertible
to <code class="docutils literal"><span class="pre">P</span></code></td>
<td>Return the port to where the request
is destined for.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">path(request)</span></code></td>
<td>Convertible
to <code class="docutils literal"><span class="pre">S</span></code></td>
<td>Return the path included in the URI.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">query(request)</span></code></td>
<td>Convertible
to <code class="docutils literal"><span class="pre">S</span></code></td>
<td>Return the query part of the URI.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">anchor(request)</span></code></td>
<td>Convertible
to <code class="docutils literal"><span class="pre">S</span></code></td>
<td>Return the anchor part of the URI.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">protocol(request)</span></code></td>
<td>Convertible
to <code class="docutils literal"><span class="pre">S</span></code></td>
<td>Return the protocol/scheme part of the
URI.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">r</span> <span class="pre">&lt;&lt;</span> <span class="pre">uri(s)</span></code></td>
<td><code class="docutils literal"><span class="pre">R&amp;</span></code></td>
<td>Set the URI of the request.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">uri(r,</span> <span class="pre">s)</span></code></td>
<td><code class="docutils literal"><span class="pre">void</span></code></td>
<td>Set the URI of the request.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="pod-server-request-concept">
<h3>Pod Server Request Concept<a class="headerlink" href="#pod-server-request-concept" title="Permalink to this headline">¶</a></h3>
<p>A type models the Pod Server Request Concept if it models the <a class="reference external" href="../in_depth/message.html#message-concept">Message Concept</a>
and also supports the following constructs.</p>
<p><strong>Legend</strong></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">R:</th><td class="field-body">The request type.</td>
</tr>
<tr class="field-even field"><th class="field-name">r:</th><td class="field-body">An instance of R.</td>
</tr>
<tr class="field-odd field"><th class="field-name">S:</th><td class="field-body">The string type.</td>
</tr>
<tr class="field-even field"><th class="field-name">I:</th><td class="field-body">An unsigned 8 bit integer.</td>
</tr>
<tr class="field-odd field"><th class="field-name">V:</th><td class="field-body">The vector type for headers.</td>
</tr>
</tbody>
</table>
<table border="1" class="docutils">
<colgroup>
<col width="41%" />
<col width="11%" />
<col width="49%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Construct</th>
<th class="head">Result</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal"><span class="pre">R::string_type</span></code></td>
<td><code class="docutils literal"><span class="pre">S</span></code></td>
<td>The nested <code class="docutils literal"><span class="pre">string_type</span></code> type.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">R::headers_container_type</span></code></td>
<td><code class="docutils literal"><span class="pre">V</span></code></td>
<td>The nested
<code class="docutils literal"><span class="pre">headers_container_type</span></code> type.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">r.source</span></code></td>
<td><code class="docutils literal"><span class="pre">S</span></code></td>
<td>The nested source of the request.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">r.method</span></code></td>
<td><code class="docutils literal"><span class="pre">S</span></code></td>
<td>The method of the request.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">r.destination</span></code></td>
<td><code class="docutils literal"><span class="pre">S</span></code></td>
<td>The destination of the request.
This is normally the URI of the
request.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">r.version_major</span></code></td>
<td><code class="docutils literal"><span class="pre">I</span></code></td>
<td>The major version number part of
the request.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">r.version_minor</span></code></td>
<td><code class="docutils literal"><span class="pre">I</span></code></td>
<td>The minor version number part of
the request.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">r.headers</span></code></td>
<td><code class="docutils literal"><span class="pre">V</span></code></td>
<td>The vector of headers.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">r.body</span></code></td>
<td><code class="docutils literal"><span class="pre">S</span></code></td>
<td>The body of the request.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="directives">
<h2>Directives<a class="headerlink" href="#directives" title="Permalink to this headline">¶</a></h2>
<p>This section details the provided directives that are provided by
<code class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></code>. The section was written to assume that an appropriately
constructed request instance is either of the following:</p>
<div class="highlight-c++"><div class="highlight"><pre><span></span><span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">basic_request</span><span class="o">&lt;</span>
  <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">tags</span><span class="o">::</span><span class="n">http_default_8bit_udp_resolve</span>
<span class="o">&gt;</span> <span class="n">request</span><span class="p">;</span>

<span class="c1">// or</span>

<span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">basic_request</span><span class="o">&lt;</span>
  <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="o">::</span><span class="n">tags</span><span class="o">::</span><span class="n">http_server</span>
<span class="o">&gt;</span> <span class="n">request</span><span class="p">;</span>
</pre></div>
</div>
<p>The section also assumes that there following using namespace declaration is in
effect:</p>
<div class="highlight-c++"><div class="highlight"><pre><span></span><span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="p">;</span>
</pre></div>
</div>
<p>Directives are meant to be used in the following manner:</p>
<div class="highlight-c++"><div class="highlight"><pre><span></span><span class="n">request</span> <span class="o">&lt;&lt;</span> <span class="n">directive</span><span class="p">(...);</span>
</pre></div>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>There are two versions of directives, those that are applicable to
messages that support narrow strings (<code class="docutils literal"><span class="pre">std::string</span></code>) and those that are
applicable to messages that support wide strings (<code class="docutils literal"><span class="pre">std::wstring</span></code>). The
<code class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></code> implementation still does not convert wide strings into
UTF-8 encoded narrow strings. This will be implemented in subsequent
library releases.</p>
<p class="last">For now all the implemented directives are listed, even if some of them still
do not implement things correctly.</p>
</div>
<dl class="docutils">
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">source(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a source directive with a <code class="docutils literal"><span class="pre">std::string</span></code> as a parameter, to be set
as the source of the request.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">source(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a source directive with a <code class="docutils literal"><span class="pre">std::wstring</span></code> as a parameter, to be set
as the source of the request.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">destination(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a destination directive with a <code class="docutils literal"><span class="pre">std::string</span></code> as a parameter, to be
set as the destination of the request.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">destination(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Create a destination directive with a <code class="docutils literal"><span class="pre">std::wstring</span></code> as a parameter, to be
set as the destination of the request.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">header(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name,</span> <span class="pre">std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">value)</span></code></dt>
<dd>Create a header directive that will add the given name and value pair to the
headers already associated with the request. In this case the name and
values are both <code class="docutils literal"><span class="pre">std::string</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">header(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name,</span> <span class="pre">std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">value)</span></code></dt>
<dd>Create a header directive that will add the given name and value pair to the
headers already associated with the request. In this case the name and
values are both <code class="docutils literal"><span class="pre">std::wstring</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">remove_header(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name)</span></code></dt>
<dd>Create a remove_header directive that will remove all the occurences of the
given name from the headers already associated with the request. In this
case the name of the header is of type <code class="docutils literal"><span class="pre">std::string</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">remove_header(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name)</span></code></dt>
<dd>Create a remove_header directive that will remove all the occurences of the
given name from the headers already associated with the request. In this
case the name of the header is of type <code class="docutils literal"><span class="pre">std::wstring</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">body(std::string</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Create a body directive that will set the request&#8217;s body to the given
parameter. In this case the type of the body is an <code class="docutils literal"><span class="pre">std::string</span></code>.</dd>
<dt><em>unspecified</em> <code class="docutils literal"><span class="pre">body(std::wstring</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Create a body directive that will set the request&#8217;s body to the given
parameter. In this case the type of the body is an <code class="docutils literal"><span class="pre">std::wstring</span></code>.</dd>
</dl>
</div>
<div class="section" id="modifiers">
<h2>Modifiers<a class="headerlink" href="#modifiers" title="Permalink to this headline">¶</a></h2>
<p>This section details the provided modifiers that are provided by
<code class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></code>.</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">source(basic_request&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">request,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">source_)</span></code></dt>
<dd>Modifies the source of the given <code class="docutils literal"><span class="pre">request</span></code>. The type of <code class="docutils literal"><span class="pre">source_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_request</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">destination(basic_request&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">request,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">destination_)</span></code></dt>
<dd>Modifies the destination of the given <code class="docutils literal"><span class="pre">request</span></code>. The type of <code class="docutils literal"><span class="pre">destination_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_request</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">add_header(basic_request&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">request,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">value)</span></code></dt>
<dd>Adds a header to the given <code class="docutils literal"><span class="pre">request</span></code>. The type of the <code class="docutils literal"><span class="pre">name</span></code> and
<code class="docutils literal"><span class="pre">value</span></code> parameters are dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of
<code class="docutils literal"><span class="pre">basic_request</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">remove_header(basic_request&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">request,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">name)</span></code></dt>
<dd>Removes a header from the given <code class="docutils literal"><span class="pre">request</span></code>. The type of the <code class="docutils literal"><span class="pre">name</span></code>
parameter is dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_request</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">clear_headers(basic_request&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">request)</span></code></dt>
<dd>Removes all headers from the given <code class="docutils literal"><span class="pre">request</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span> <span class="pre">inline</span> <span class="pre">void</span> <span class="pre">body(basic_request&lt;Tag&gt;</span> <span class="pre">&amp;</span> <span class="pre">request,</span> <span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">body_)</span></code></dt>
<dd>Modifies the body of the given <code class="docutils literal"><span class="pre">request</span></code>. The type of <code class="docutils literal"><span class="pre">body_</span></code> is
dependent on the <code class="docutils literal"><span class="pre">Tag</span></code> specialization of <code class="docutils literal"><span class="pre">basic_request</span></code>.</dd>
</dl>
</div>
<div class="section" id="wrappers">
<h2>Wrappers<a class="headerlink" href="#wrappers" title="Permalink to this headline">¶</a></h2>
<p>This section details the provided request wrappers that come with
<code class="xref py py-mod docutils literal"><span class="pre">cpp-netlib</span></code>. Wrappers are used to convert a message into a different type,
usually providing accessor operations to retrieve just part of the message. This
section assumes that the following using namespace directives are in
effect:</p>
<div class="highlight-c++"><div class="highlight"><pre><span></span><span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="p">;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">network</span><span class="o">::</span><span class="n">http</span><span class="p">;</span>
</pre></div>
</div>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">source(basic_request&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">request)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span></code> that
provides the source of a given request.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">destination(basic_request&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">request)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span></code> that
provides the destination of a given request.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">headers(basic_request&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">request)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">headers_range&lt;basic_request&lt;Tag&gt;</span>
<span class="pre">&gt;::type</span></code> or <code class="docutils literal"><span class="pre">typename</span> <span class="pre">basic_request&lt;Tag&gt;::headers_container_type</span></code> that
provides the headers of a given request.</dd>
<dt><code class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">Tag&gt;</span></code> <em>unspecified</em> <code class="docutils literal"><span class="pre">body(basic_request&lt;Tag&gt;</span> <span class="pre">const</span> <span class="pre">&amp;</span> <span class="pre">request)</span></code></dt>
<dd>Returns a wrapper convertible to <code class="docutils literal"><span class="pre">typename</span> <span class="pre">string&lt;Tag&gt;::type</span></code> that
provides the body of a given request.</dd>
</dl>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">HTTP Request</a><ul>
<li><a class="reference internal" href="#request-concepts">Request Concepts</a><ul>
<li><a class="reference internal" href="#normal-client-request-concept">Normal Client Request Concept</a></li>
<li><a class="reference internal" href="#pod-server-request-concept">Pod Server Request Concept</a></li>
</ul>
</li>
<li><a class="reference internal" href="#directives">Directives</a></li>
<li><a class="reference internal" href="#modifiers">Modifiers</a></li>
<li><a class="reference internal" href="#wrappers">Wrappers</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="http_client.html"
                        title="previous chapter">HTTP Client API</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="http_response.html"
                        title="next chapter">HTTP Response</a></p>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="http_response.html" title="HTTP Response"
             >next</a></li>
        <li class="right" >
          <a href="http_client.html" title="HTTP Client API"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../contents.html">cpp-netlib v0.12.0</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="../reference.html" >Reference Manual</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &copy; Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
      Last updated on Mar 29, 2016.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.6.
    </div>
  </body>
</html>